feat: calculator v61 redesign & os widget#554
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6c2d065d16
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| CalculatorHomeScreenWidgetEntryView(entry: entry) | ||
| } | ||
| .configurationDisplayName("widgets__calculator__name") | ||
| .description("widgets__calculator__description") |
There was a problem hiding this comment.
Use a static calculator widget description
The home-screen widget gallery cannot perform the app's t(..., variables:) substitution here, but widgets__calculator__description is the in-app string that contains {fiatSymbol}. As a result, when users add the new Calculator OS widget from the iOS widget gallery, the description is shown with the literal {fiatSymbol} placeholder instead of a real currency symbol or generic text.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 76f4cc3403
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if values.bitcoinValue.isEmpty, saved.bitcoinValue.isEmpty { | ||
| values.bitcoinValue = CalculatorWidgetValues().bitcoinValue | ||
| } |
There was a problem hiding this comment.
Preserve an intentionally cleared calculator amount
When the user deletes all digits from the calculator, persistValues() saves an empty bitcoinValue; on the next render this branch treats that saved empty value as uninitialized, resets it to the default 10000, and immediately persists that default again. Since load() already returns CalculatorWidgetValues() for a missing App Group value, saved.bitcoinValue.isEmpty here only represents an intentionally cleared amount, so navigating away/back or reopening the app unexpectedly changes the calculator and home-screen widget from blank/0 back to 10,000 sats.
Useful? React with 👍 / 👎.
Description
This PR:
Mirrors the Calculator app and OS widget work from synonymdev/bitkit-android#942.
Linked Issues/Tasks
N/A
Screenshot / Video
Not attached in this pass.
QA Notes
Manual Tests
regression:Settings → General → Default Unit → switch Modern/Classic → Home → Calculator widget: Bitcoin amount is preserved while denomination formatting changes.Automated Checks
BitkitTests/CalculatorWidgetTests.swiftcovers calculator grouping, decimal placeholder behavior, number-pad delete/decimal caps, localized comma input normalization, symbol shortening, and classic BTC-to-sats conversion.1updated10 000 / $6.66to100 001 / $66.59.joined(separator:)helper and crashed when opening the Calculator preview;76f4cc34replaces it with direct left-to-right grouping.swiftformatpassed for changed Swift files.node scripts/validate-translations.jspassed with 0 errors.xcodebuild ... -only-testing:BitkitTests/CalculatorWidgetTests build-for-testingpassed.LDKNodeFFI.frameworksimulator install stub from DerivedData, thenxcodebuild test-without-building ... -only-testing:BitkitTests/CalculatorWidgetTestspassed with 7 tests and 0 failures.build_simforBitkitDebug on iPhone 16 Pro iOS 18.5 passed, including the Widget extension target; remaining warnings are pre-existingPubkyImage.swiftSwift 6 async lock/unlock warnings.Run Tests,build-local, andbuild-stagingpassed; e2e jobs were still running when last checked.